from datetime import datetime

from sqlalchemy import Column, DateTime

class User(Base):
    __tablename__ = "users"
    
    created_time = Column(DateTime, default=datetime.now)
    
    @property
    def created_time_iso(self):
        return self.created_time.isoformat() if self.created_time else None
    
    def to_dict(self):
        return {
            "id": self.id,
            "phone": self.phone,
            "created_time": self.created_time_iso,
            # 其他字段...
        } 